<?php

class CustomerController extends Controller
{
	public $firstname1='';
	public function actionIndex()
	{
		$models = new MyTable();
		$models = $models->findAll();
		//echo '<pre>';print_r($models);echo '</pre>';exit();
		//$models=$this->mydatabase->myTable->find('all');
		$this->render('index',array('models'=>$models));
	}
	public function actionCreate()
	{
		$this->render('create');
	}
	public function actionEdit()
	{
		$model=new MyTable();
		$model=$model->findByPK($_GET['id']);
		echo ($_GET['id']);
		$this->render('edit',array('model'=>$model));
	}
	public function actionEdit1()
	{
		$model=new MyTable();
		$model=$model->findByPK($_GET['id']);
		echo ($model->name);
		$model->name=$_POST['t1'];
		$model->Age=$_POST['t2'];
		$model->save();
		$this->render('edit1');
	}
	
	public function actioncreateARecord()
	{
		echo("in function");
		$model = new MyTable();
		
		$model->name=$_POST['t1'];
		$model->Age=$_POST['t2'];
		$model->save();
		echo("end function");
	}
	public function actionDelete()
	{
		$model = new MyTable();
		$model=$model->findByPK($_GET['id']);
		$model->delete();
		$this->render('delete');
	}
	// Uncomment the following methods and override them if needed
	/*
	public function filters()
	{
		// return the filter configuration for this controller, e.g.:
		return array(
			'inlineFilterName',
			array(
				'class'=>'path.to.FilterClass',
				'propertyName'=>'propertyValue',
			),
		);
	}

	public function actions()
	{
		// return external action classes, e.g.:
		return array(
			'action1'=>'path.to.ActionClass',
			'action2'=>array(
				'class'=>'path.to.AnotherActionClass',
				'propertyName'=>'propertyValue',
			),
		);
	}
	*/
}